<?php

namespace JsonLowCode\UI;

use JsonLowCode\Schema;
use JsonLowCode\Traits\Props\HasBordered;
use JsonLowCode\Traits\Props\HasColor;
use JsonLowCode\Traits\Props\HasRound;

/**
 * 头像组组件 NAvatarGroup
 * @method static AvatarGroup make(array $options,mixed $children = null) AvatarGroup组件
 */
class AvatarGroup extends Avatar
{

    protected string $componentName = "NAvatarGroup";

    public function __construct(array $options,mixed $children = null)
    {
        parent::__construct();
        if ($options){
            $this->options($options);
        }
        $this->children($children);
    }


    /**
     * 组内头像显示的最大个数
     * @param string|int $max
     * @return $this
     */
    public function max(string|int $max): static
    {
        return $this->prop('max', $max);
    }

    /**
     * 溢出标识的样式
     * @param string|array $maxStyle
     * @return $this
     */
    public function maxStyle(string|array $maxStyle): static
    {
        return $this->prop('max-style', $maxStyle);
    }

    /**
     * 头像组的选项
     * @param string|array $options [['name'=>'','src'=>'']]
     * @return $this
     */
    public function options(string|array $options): static
    {
        return $this->prop('options', $options);
    }

    /**
     * 组内头像是否垂直排列
     * @param bool|string $bool
     * @return $this
     */
    public function vertical(bool|string $bool = true): static
    {
        return $this->prop('vertical', $bool);
    }

    /**
     * 头像组头像 slot avatar
     * 参数 (info: { option: { src: string } })
     * @param Schema $avatar
     * @return $this
     */
    public function slotAvatar(Schema $avatar): static
    {
        return $this->slot('avatar',$avatar);
    }


    /**
     * 头像组溢出容器 slot rest
     * 参数 (info: { options: Array<{ src: string }>, rest: number })
     * @param Schema $rest
     * @return $this
     */
    public function slotRest(Schema $rest): static
    {
        return $this->slot('rest',$rest);
    }
}
